package example.lec02;

public class Person {
    private int age;

    private Book book;

    public Person()
    {

    }
    public Person(Book book)
    {
        this.book = book;
    }

    public String toString() // 覆盖默认的字符串输出方法
    {
        return "I'm a person, I want to read a book! " ; // book.toString() book为空会导致空异常
    }

    public void setBook(Book book)
    {
        this.book = book;
    }

}
